﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using ScrumTime.Models;

namespace ScrumTime.Helpers
{
    public class Users
    {
        static Users _Instance;
       // List<User> _Users;

        ScrumTimeEntities _ScrumTimeEntities;

        private Users()
        {

           
            _ScrumTimeEntities = new ScrumTimeEntities();

        //    _Users = ScrumTime.Services.UserService.GetAllUsabilityFeatures(_ScrumTimeEntities);
        }

        //public static List<User> All()
        //{
        //    if (_Instance == null)
        //        _Instance = new Users();
        //    return _Instance._Users;
        //}




        private bool _IsUserAdmin(String userId) {
            bool resultado = false;
            User user = ScrumTime.Services.UserService.GetUserById(_ScrumTimeEntities, userId);

            if (user != null) {
                resultado = user.IsAdmin.Value;
            }
            return resultado;
        }


        public static bool IsUserAdmin( String userId){
            if (_Instance == null)
                _Instance = new Users();
            return _Instance._IsUserAdmin(userId);
        }


    }
}